//
// Created by lzw on 24-10-19.
//

#ifndef CMONKEY_AST_H
#define CMONKEY_AST_H

#include "token.h"

struct s_token;

struct i_node
{
    char *(*token_literal)(struct i_node *node);
};

struct i_statement
{
    struct i_node node;
    void (*statement_node)(struct i_statement *node);
};

struct i_expression
{
    struct i_node node;
    void (*expression_node)(struct i_expression *node);
};

struct s_identifier
{
    struct s_token token;
    char *value;
};

struct s_letstatement
{
    struct s_token token;
    struct s_identifier name;
    struct i_expression value;
};

void letstatement_statement_node(struct s_letstatement *ls);

char *letstatement_token_literal(struct s_letstatement *ls);

struct s_program
{
    unsigned int length;
    struct i_statement *statements[];
};

char *program_token_literal(struct s_program *program);

#endif // CMONKEY_AST_H
